﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MP3Ganizer.BusinessObject.Services.Configuration.Builders;

namespace MP3Ganizer.BusinessObject.Services.Configuration
{
    class ConfigurationServiceFactory
    {
        private static ConfigurationServiceFactory _instance;
        public static ConfigurationServiceFactory Instance
        {
            get
            {
                if (_instance != null)
                    return _instance;
                _instance = new ConfigurationServiceFactory();
                return _instance;
            }
        }

        private Dictionary<InfoType, IConfigurationBuilder> _builders;


        public ConfigurationServiceFactory()
        {
            _builders = new Dictionary<InfoType,IConfigurationBuilder>();
            _builders.Add(InfoType.Albums, new AlbumsBuilder());
            _builders.Add(InfoType.Artists, new ArtistsBuilder());
            _builders.Add(InfoType.ArtistsEntireList, new ArtistsEntireListBuilder());
            _builders.Add(InfoType.Source, new SourceBuilder());
            _builders.Add(InfoType.Destination, new DestinationBuilder());
        }

        internal bool TryToGetBuilderForInfoType(InfoType type, out IConfigurationBuilder builder)
        {
            return _builders.TryGetValue(type, out builder);
        }
    }

    public enum InfoType
    {
        Albums,
        Artists,
        Source,
        Destination,
        ArtistsEntireList,
    }
}
